<?php

namespace App\Observers;

use App\Models\Withdraw;

class WithdrawObserver
{
	public function creating(Withdraw $withdraw)
	{
		if (! $withdraw->number) {
			$withdraw->number = serial_number(6, $withdraw, 'number');
			if (! $withdraw->number) {
				return false; // Withdraw is failed.
			}
		}
	}
}
